<?php
/**
 * Bdat Site development
 * @author Will Skates
 */

/*----------------------------------------------------------------------------------------------------*/

/**
 * Outline of properties and functionality required to manage content on the system based on the available structural data.
 * @author Will Skates
 */
class adminmodel extends CI_Model {
	
	/**
	 * Get a list of all content types from the database.
	 * @param	StdClass	$obj	-	An object containing data about the system configuration.
	 * @return	Void
	 */
	public function getTypes( $obj )
	{
		
		$this->load->helper('inflector');
		
		$sql = 'SHOW TABLES';
		$result = $this->db->query($sql)->result();
		
		$names = array();
		$field = '';
		
		foreach ( $result as $key=>$value ) {
			
			if ( $field == '' ) { $field = reset(array_keys((Array)$value)); }
			
			$name = ucfirst(camelize(humanize($value->$field)));
			
			
			if(!in_array($name, $obj->ignore)) {
				$names[] = singular($name);
			}
				
			
		}
		
		return $names;
		
	}
	
	/*----------------------------------------------------------------------------------------------------*/
	
}